package com.trip.user.controller;


import com.trip.common.dto.LoginDto;
import com.trip.common.dto.RegDto;
import com.trip.common.entity.TripUser;
import com.trip.common.vo.Result;
import com.trip.user.service.impl.SysUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author hr
 * @since 2024-09-05
 */
@RestController
@RequestMapping("/user")
public class SysUserController {
    @Autowired
    private SysUserServiceImpl sysUserService;

    @RequestMapping("/loginByAccount")
    public Result loginByAccount(@RequestBody LoginDto loginDto){
        return sysUserService.loginByAccount(loginDto);
    }

    @RequestMapping("/loginByEmail")
    public Result loginByEmail(@RequestBody LoginDto loginDto){
        return sysUserService.loginByEmail(loginDto);
    }

    @RequestMapping("/sendEmail")
    public void sendEmail(@RequestBody String email){
        sysUserService.sendEmail(email);
    }

    @RequestMapping("/register")
    public Result register(@RequestBody RegDto regDto){
        return sysUserService.register(regDto);
    }

    @RequestMapping("/checkIsRegisterByUserName")
    public Result checkIsRegisterByUserName(@RequestBody RegDto regDto){
        return sysUserService.checkIsRegisterByUserName(regDto);
    }
    @RequestMapping("/checkIsRegisterByEmail")
    public Result checkIsRegisterByEmail(@RequestBody RegDto regDto){
        return sysUserService.checkIsRegisterByEmail(regDto);
    }
    @RequestMapping("/checkIsRegisterByPhone")
    public Result checkIsRegisterByPhone(@RequestBody RegDto regDto){
        return sysUserService.checkIsRegisterByPhone(regDto);
    }
}

